// ---------------------------------------主程序入口-------------------------------
backHomeApp.controller('indexController', ["$scope", "$rootScope", "$location", "$uibModal", "DPUtil", "UIUtil", "$state","infoService","itemService",
    function($scope, $rootScope, $location, $uibModal, DPUtil, UIUtil, $state,infoService,itemService) {
        //通用路径跳转
        $scope.pathUrl = function(url) {
            $state.go(url);
        };
        $rootScope.g_clientType=[];
        $rootScope.g_document=[];
        $rootScope.g_condition=[];
        $rootScope.g_preResult=[];
        $rootScope.g_finallyResult=[];
        $rootScope.g_periods=[];
        (function(){
            infoService.info().then(function(data){
                $scope.userName = data.successMessage || "";
            });
        })();
        $scope.getOut = function() {
            UIUtil.comfirm({
                content: "是否退出账号？",
                ok: function() {
                    infoService.logout().then(function(data){
                        if (data.success) {
                            window.location.href = DPUtil.getContextPath() + "/view/login.html";
                        }else{
                            UIUtil.alert({content:data.failureMessage});
                        }
                    });
                     // window.location.href = DPUtil.getContextPath() + "/logout.do";
                }
            });
        };
        $scope.changePassword = function() {
            $uibModal.open({
                animation: true,
                templateUrl: 'backHomeTpl/businessTpl/changePassword.html',
                keyboard: false,
                backdrop: 'static',
                size: "pw",
                controller: ["$scope", "$uibModalInstance",
                    function(scope, uibModal) {
                        scope.cancel = function() {
                            uibModal.close();
                        };
                        scope.ok = function() {
                            if (scope.new_password == scope.repeat_password) {
                                UIUtil.alert({ content: "修改成功！" });
                            } else {
                                UIUtil.alert({ content: "输入密码不一致！" });
                            }
                        };
                    } //end fn
                ]
            }); //end open
        };
        $rootScope.loading = true;
    }
]);

/*-------------------------------------------主页--------------------------------*/
backHomeApp.controller('homeController', ['$scope', '$location',
    function($scope, $location) {

    }
]);



